﻿Imports System.Data.SqlClient

Public Class ClientesDAO
    Inherits Datos
    Private _nombre As String
    Private Str As String = Sconn
    Public ListaDAO As New List(Of Clientes)

    Sub New()
        Me._nombre = _nombre
    End Sub


    Public Property Nombre() As String

        Get
            Return Me._nombre
        End Get
        Set(ByVal value As String)
            Me._nombre = value
        End Set
    End Property

    Function GetClientes(ByVal cliente)
        Dim Conn As New SqlConnection(Str)
        Conn.Open()
        Dim Cmd As New SqlCommand("SELECT * FROM CLIENTES WHERE DESCRIPCION LIKE'%" + cliente + "%'", Conn)
        Dim reader = Cmd.ExecuteReader
        While reader.Read()
            Dim Cli As New Clientes
            Cli.Nombre = reader(1)
            Cli.Direccion = reader(2)
            Cli.Telefono = reader(3)
            Cli.Localidad = reader(4)
            ListaDAO.Add(Cli)
        End While
        Conn.Close()
        Return ListaDAO
    End Function

End Class
